﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SwinGame;


namespace SimpleSurvival.src
{
    //-----------------------------------------------//
    //CLASS - TextBox.cs
    //-----------------------------------------------//
    //Displays text and can be clicked//
    //A button
    public class Textbox
    {
        Point2D _position = new Point2D();
        Point2D _size = new Point2D();
        bool _isHidden = true;

        public bool IsHidden
        {
            get { return _isHidden; }
            set { _isHidden = value; }
        }

        string _name;

        public Textbox(int posX, int posY, int sizeX, int sizeY, string name)
        {
            _position.X = posX;
            _position.Y = posY;
            _size.X = sizeX;
            _size.Y = sizeY;
            _name = name;
        }

        bool ContainsPoint(Point2D p)
        {
            return p.InRect(_position.X,
            _position.Y, _size.X, _size.Y);
        }

        public bool IsPressed()
        {
            return Input.MouseClicked(MouseButton.LeftButton)
            && ContainsPoint(Input.MousePosition())
            && _isHidden == false;
        }
        public void Draw()  //Update to use accessors instead
        {
            if (!_isHidden)
            {
                Graphics.DrawRectangleOnScreen(System.Drawing.Color.Black, false, (int)_position.X, (int)_position.Y, (int)_size.X, (int)_size.Y);
                SwinGame.Text.DrawText(_name, System.Drawing.Color.Black, _position);
            }
        }
    }
}
